package com.project.system.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.system.user.dao.UserDao;
import com.project.system.user.entity.UserEntity;
import com.project.system.user.service.IUserService;
import org.springframework.stereotype.Service;

/**
 * 商铺员工服务实现类
 *
 * @author yanhaizhen
 * @since 2022-02-28 13:37:44
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements IUserService {

    /**
     * 根据手机号查询用户
     *
     * @param phone 手机号
     * @return 用户实体类
     */
    @Override
    public UserEntity getUserByPhone(String phone) {
        LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(UserEntity::getPhone, phone);
        // 门店员工状态：0-禁用，1-启用
//        queryWrapper.eq(UserEntity::getStatus, 1);

        return this.getOne(queryWrapper);
    }

}

